package ankh.scene;

import ankh.Ankh;

public class Scene
{
	
	protected Ankh _ankh;
	protected IScene _current;
	protected boolean _started = false;
	
	public IScene getCurrent() { return _current; }
	
	public Scene(Ankh ankh)
	{
		_ankh = ankh;
	}
	
	public void setCurrent(IScene newScene)
	{
		if (_current != null) _current.terminate(_ankh);
		_current = newScene;
		_started = false;
	}
	
	public void update()
	{
		if ((_ankh.getGraphics().getGL() == null) || (_current == null)) return;
		if (_started)
			_current.update(_ankh);
		else
		{
			_current.start(_ankh);
			_started = true;
		}
	}
	
	public void draw()
	{
		if (_current == null) return;
		_current.draw(_ankh);
	}
	
}
